.class Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;
.super Ljava/lang/Object;

# interfaces
.implements Lcom/hyphenate/EMCallBack;


# instance fields
.field innerCallback:Lcom/hyphenate/EMCallBack;

.field private strong:Lcom/hyphenate/EMCallBack;

.field private weak:Ljava/lang/ref/WeakReference;


# direct methods
.method constructor <init>(Lcom/hyphenate/EMCallBack;)V
    .locals 1

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->innerCallback:Lcom/hyphenate/EMCallBack;

    new-instance v0, Ljava/lang/ref/WeakReference;

    invoke-direct {v0, p1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    iput-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->weak:Ljava/lang/ref/WeakReference;

    return-void
.end method


# virtual methods
.method declared-synchronized getRef()Lcom/hyphenate/EMCallBack;
    .locals 1

    monitor-enter p0

    :try_start_0
    iget-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->strong:Lcom/hyphenate/EMCallBack;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->strong:Lcom/hyphenate/EMCallBack;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    :goto_0
    monitor-exit p0

    return-object v0

    :cond_0
    :try_start_1
    iget-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->weak:Ljava/lang/ref/WeakReference;

    if-eqz v0, :cond_1

    iget-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->weak:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/hyphenate/EMCallBack;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    :cond_1
    const/4 v0, 0x0

    goto :goto_0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method declared-synchronized makeItStrong()V
    .locals 1

    monitor-enter p0

    :try_start_0
    iget-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->strong:Lcom/hyphenate/EMCallBack;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-eqz v0, :cond_1

    :cond_0
    :goto_0
    monitor-exit p0

    return-void

    :cond_1
    :try_start_1
    iget-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->weak:Ljava/lang/ref/WeakReference;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->weak:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->weak:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/hyphenate/EMCallBack;

    iput-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->strong:Lcom/hyphenate/EMCallBack;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public onError(ILjava/lang/String;)V
    .locals 1

    iget-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->innerCallback:Lcom/hyphenate/EMCallBack;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->innerCallback:Lcom/hyphenate/EMCallBack;

    invoke-interface {v0, p1, p2}, Lcom/hyphenate/EMCallBack;->onError(ILjava/lang/String;)V

    :cond_0
    invoke-virtual {p0}, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->getRef()Lcom/hyphenate/EMCallBack;

    move-result-object v0

    if-eqz v0, :cond_1

    invoke-interface {v0, p1, p2}, Lcom/hyphenate/EMCallBack;->onError(ILjava/lang/String;)V

    invoke-virtual {p0}, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->release()V

    :cond_1
    return-void
.end method

.method public onProgress(ILjava/lang/String;)V
    .locals 1

    iget-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->innerCallback:Lcom/hyphenate/EMCallBack;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->innerCallback:Lcom/hyphenate/EMCallBack;

    invoke-interface {v0, p1, p2}, Lcom/hyphenate/EMCallBack;->onProgress(ILjava/lang/String;)V

    :cond_0
    invoke-virtual {p0}, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->getRef()Lcom/hyphenate/EMCallBack;

    move-result-object v0

    if-eqz v0, :cond_1

    invoke-interface {v0, p1, p2}, Lcom/hyphenate/EMCallBack;->onProgress(ILjava/lang/String;)V

    :cond_1
    return-void
.end method

.method public onSuccess()V
    .locals 1

    iget-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->innerCallback:Lcom/hyphenate/EMCallBack;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->innerCallback:Lcom/hyphenate/EMCallBack;

    invoke-interface {v0}, Lcom/hyphenate/EMCallBack;->onSuccess()V

    :cond_0
    invoke-virtual {p0}, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->getRef()Lcom/hyphenate/EMCallBack;

    move-result-object v0

    if-eqz v0, :cond_1

    invoke-interface {v0}, Lcom/hyphenate/EMCallBack;->onSuccess()V

    invoke-virtual {p0}, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->release()V

    :cond_1
    return-void
.end method

.method declared-synchronized release()V
    .locals 2

    monitor-enter p0

    :try_start_0
    iget-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->strong:Lcom/hyphenate/EMCallBack;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-nez v0, :cond_0

    :goto_0
    monitor-exit p0

    return-void

    :cond_0
    :try_start_1
    new-instance v0, Ljava/lang/ref/WeakReference;

    iget-object v1, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->strong:Lcom/hyphenate/EMCallBack;

    invoke-direct {v0, v1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    iput-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->weak:Ljava/lang/ref/WeakReference;

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->strong:Lcom/hyphenate/EMCallBack;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method declared-synchronized update(Lcom/hyphenate/EMCallBack;)V
    .locals 1

    monitor-enter p0

    :try_start_0
    iget-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->strong:Lcom/hyphenate/EMCallBack;

    if-eqz v0, :cond_0

    iput-object p1, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->strong:Lcom/hyphenate/EMCallBack;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    :goto_0
    monitor-exit p0

    return-void

    :cond_0
    :try_start_1
    new-instance v0, Ljava/lang/ref/WeakReference;

    invoke-direct {v0, p1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    iput-object v0, p0, Lcom/hyphenate/chat/EMMessage$EMCallbackHolder;->weak:Ljava/lang/ref/WeakReference;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method
